package com.aruba.attendance.ui.widget.statusbar

import androidx.compose.foundation.background
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.*
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import com.google.accompanist.systemuicontroller.rememberSystemUiController

/**
 * Created by aruba on 2023/2/10.
 */

// 相同代码
@Composable
fun SystemUiControllerX() {
    val systemUiController = rememberSystemUiController()
    val useDarkIcons = !isSystemInDarkTheme()
    val localColor = LocalContentColor.current
    
    SideEffect {
        systemUiController.setSystemBarsColor(
            color = localColor,
            darkIcons = useDarkIcons
        )
    }
}

// 复制替换掉以下代码块即可
/**
 * 半透明状态栏
 */
@Composable
fun StatusBarCustom6() {
    Column(
        modifier = Modifier
            .fillMaxSize()
            .background(Color.Yellow)
    ) {
        val appBarColor = MaterialTheme.colorScheme.surface.copy(alpha = 0.1f)

        Spacer(
            Modifier
                .fillMaxWidth()
                .background(appBarColor)
                .windowInsetsTopHeight(WindowInsets.statusBars)
        )
    }
}